import 'package:flutter/material.dart';
import 'package:flutter_demo/component/BottomTab_Widget.dart';
import 'package:flutter_demo/component/CustomScrollView_Widget.dart';
import 'package:flutter_demo/component/Flex_Stack_Positioned_Widget.dart';
import 'package:flutter_demo/component/Flutter_to_Android.dart';
import 'package:flutter_demo/component/GridView_Widget.dart';
import 'package:flutter_demo/component/InheritedWidget_Test.dart';
import 'package:flutter_demo/component/ScrollView_Widget.dart';
import 'package:flutter_demo/component/XuanFu_Widget.dart';
import '../component/CustomPicBottomTab_Widget.dart';
import '../component/DefaultTabController_Widget.dart';
import '../component/Route_Widget.dart';
import '../component/TextField_Widget.dart';
import '../component/Text_Widget.dart';
import '../route_widget/FirstPage.dart';
import '../route_widget/SecondPage.dart';
import '../route_widget/ThirdPage.dart';
import '../route_widget/FourthPage.dart';
import '../route_widget/FifthPage.dart';
import '../route_widget/SixthPage.dart';

final Map routes = {
  "/bottomtab": (context) => BottomTab_Widget(),
  "/custom_bottomtab": (context) => CustomPicBottomTab_Widget(),
  "/top_tab": (context) => DefaultTabController_Widget(),
  "/flutter_to_android": (context) => Flutter_to_Android(),
  "/route_widget": (context) => Route_Widget(),
  "/text_widget": (context) => Text_Widget(),
  "/edit_widget": (context) => TextField_Widget(),
  "/gridview_widget": (context) => GridView_Widget(),
  "/scrollview_widget": (context) => ScrollView_Widget(),
  "/customscrollview_widget": (context) => CustomScrollView_Widget(),
  "/xuanfu_widget": (context) => XuanFu_Widget(),
  "/inherited_widget": (context) => InheritedWidget_Test(),






  "/first": (context) => FirstPage(),
  "/second": (context) => SecondPage(),
  "/third": (context, {arguments}) => ThirdPage(arguments: arguments),
  "/fourth": (context, {arguments}) => FourthPage(arguments: arguments),
  "/fifth": (context, {arguments}) => FifthPage(arguments: arguments),
  "/sixth": (context, {arguments}) => SixthPage(arguments: arguments),
  "/layout": (context) => Flex_Stack_Positioned_Widget()
};
final RouteFactory onGenerateRoute = (RouteSettings settings) {
  final String? name = settings.name;
  final pageBuilder = routes[name];
  if (settings.arguments != null) {
    // 创建路由页面并携带参数
    return MaterialPageRoute(
        builder: (context) =>
            pageBuilder(context, arguments: settings.arguments));
  } else {
    return MaterialPageRoute(builder: (context) => pageBuilder(context));
  }
};
